import request from "../utils/request.ts";

// 登录
export function login(data: object) {
    return request({
        url: "/auth/login",
        method: "POST",
        data,
    });
}

// 获取登录用户信息
export function user() {
    return request({
        url: "/admin/user",
        method: "GET",
        // 设置请求头
        headers: {
            Authorization: `Bearer ${localStorage.getItem("token")}`,
        },
    });
}

// 退出登录
export function logout() {
    return request({
        url: "/auth/logout",
        method: "POST",
        // 设置请求头
        headers: {
            Authorization: `Bearer ${localStorage.getItem("token")}`,
        },
    });

}